package com.gzsxy.sso.core.controller;

import com.gzsxy.sso.core.utils.SessionUserUtil;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.security.Principal;

/**
 * @author xiaolong
 * @version 1.0
 * @description: 认证中心
 * @date 2021/11/17 15:50
 */
@Api(description = "认证中心")
@CrossOrigin  //解决跨域
@RestController
@RequestMapping("/admin/auth")
public class AuthController {


    /**
     * @description: 根据token获取用户信息
     * @param  user 用户信息
     * @return
     */
    @GetMapping("/user")
    public Object user(Principal user){
        try {
            return SessionUserUtil.getSessionUser();
        } catch (Exception e) {
        }
        return user;
    }



}
